var Dispatcher = require('flux').Dispatcher;
var Stores = require('./store');
var Settings = require('./setting');

var getHomeModuleList = require('../../services/getHomeModuleList');
var getFavoriteList = require('../../services/getFavoriteList');


var AppDispatcher = new Dispatcher();


//  注册Action
AppDispatcher.register(function (action) {
    switch(action.actionType) {
        case 'GET_HOMEMODULE':
            getHomeModuleList.getData(action.param,Stores.getHomeModuleList);
            break;

        case 'GET_FAVORITE':
            getFavoriteList.getData(action.param);
            break;

        default:
    }
});


//  Action派发回调事件
var Actions = {
    common: function (PORT,param) {
        AppDispatcher.dispatch({
            actionType: PORT,
            param: param
        });
    }
};

module.exports = Actions;